/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.admin.entity;

import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import org.springblade.core.mp.base.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

/**
 * 工作项评分记录实体类
 *
 * @author ysq
 * @since 2024-01-16
 */
@Data
@TableName("blade_plan_check_history_score")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "PlanCheckHistoryScore对象", description = "工作项评分记录")
public class PlanCheckHistoryScore extends BaseEntity {

	private static final long serialVersionUID = 1L;

	/**
	 * 工单id
	 */
	@ApiModelProperty(value = "工单id")
	private Long planId;
	/**
	 * 电梯di
	 */
	@ApiModelProperty(value = "电梯di")
	private Long elevatorId;
	/**
	 * 项目id
	 */
	@ApiModelProperty(value = "项目id")
	private Long buildingId;
	/**
	 * 业务id
	 * 包括-绑定保养工作项，维修记录id,等后期需求
	 */
	@ApiModelProperty(value = "业务id")
	private Long checkHistoryId;
	/**
	 * 评分用户id
	 */
	@ApiModelProperty(value = "评分用户id")
	private Long scoreUserId;
	/**
	 * 评分用户名称
	 */
	@ApiModelProperty(value = "评分用户名称")
	private String scoreUserName;
	/**
	 * 评分备注
	 */
	@ApiModelProperty(value = "评分备注")
	private String scoreDesc;
	/**
	 * 评分-工作性质名称
	 */
	@ApiModelProperty(value = "评分-工作性质名称")
	private String dimensionName;
	/**
	 * 评分-工作性质id
	 */
	@ApiModelProperty(value = "评分-工作性质id")
	private Long scoreDimensionId;
	/**
	 * 评分项id
	 */
	@ApiModelProperty(value = "评分项id")
	private Long dimensionItemId;
	/**
	 * 分值代号
	 */
	@ApiModelProperty(value = "分值代号")
	private String scoreLevel;
	/**
	 * 标准评分分数
	 */
	@ApiModelProperty(value = "标准评分分数")
	private BigDecimal score;
	/**
	 * 工作项应得分数
	 */
	@ApiModelProperty(value = "工作项应得分数")
	private BigDecimal checkScore;

	@ApiModelProperty(value = "By-必须项 0-非必须，1-必须")
	private Integer isHasQuestion;


	@ApiModelProperty("维修-故障原因ids")
	private String wxFaultCauseIds;

	@ApiModelProperty("维修-故障原因其它描述")
	private String wxFaultCauseDesc;


	@ApiModelProperty("维修-问题责任ids")
	private String wxFaultTypeIds;

	@ApiModelProperty("维修-问题责任其它描述")
	private String wxFaultTypeDesc;


	@ApiModelProperty("维修-故障原因ids")
	@TableField(exist = false)
	private List<String> wxFaultCauseNames;


	@ApiModelProperty("维修-问题责任ids")
	@TableField(exist = false)
	private List<String> wxFaultTypeNames;

	@ApiModelProperty("维修-故障原因ids")
	@TableField(exist = false)
	private List<String> wxFaultIds;

	@ApiModelProperty("维修-问题责任ids")
	@TableField(exist = false)
	private List<String> wxTypeIds;

	@ApiModelProperty("配件名称")
	@TableField(exist = false)
	private String partsNames;

	@TableField(exist = false)
	private MaintainByScoreQuestionAppeal appeal;

	/**
	 * 保养-评分模板
	 */
	@TableField(exist = false)
	private List<PlanScoreDimensionItem> scoreTemplate;


	/**
	 * 维修-评分问题记录
	 */
	@TableField(exist = false)
	private List<MaintainMalfunctionHistory> maintainMalfunctionHistorys;


	/**
	 * 工作项问题记录
	 */
	@TableField(exist = false)
	private MaintainByScoreQuestion maintainByScoreQuestion;

	public void setWxFaultTypeIds(String wxFaultTypeIds) {
		this.wxFaultTypeIds = wxFaultTypeIds;
		if (StrUtil.isNotEmpty(wxFaultTypeIds)) {
			this.wxTypeIds = Arrays.asList(wxFaultTypeIds.split(","));
		}
	}

	public void setWxFaultCauseIds(String wxFaultCauseIds) {
		this.wxFaultCauseIds = wxFaultCauseIds;
		if (StrUtil.isNotEmpty(wxFaultCauseIds)) {
			this.wxFaultIds = Arrays.asList(wxFaultCauseIds.split(","));
		}
	}
}
